package main

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"net/http"
	"time"
)


func formatAsDate(t time.Time) string {
	year, month, day := t.Date()
	return fmt.Sprintf("%d%02d/%02d", year, month, day)
}

func main() {


	router := gin.Default()
	router.LoadHTMLGlob("views/*")

	router.GET("/", func(c *gin.Context) {
		c.HTML(http.StatusOK, "index.tmpl", gin.H{
			"title": "Main website",
		})
	})
	router.GET("/raw", func(c *gin.Context) {
		c.HTML(http.StatusOK, "raw.tmpl", map[string]interface{}{
			"now": time.Date(2017, 07, 01, 0, 0, 0, 0, time.UTC),
		})
	})




	router.GET("/ok", func(c *gin.Context) {
		c.String(http.StatusOK, "Hello Ketty")
	})

	http.ListenAndServe(":8080", router)
}
